package s;

import java.io.IOException;
import java.util.List;
import java.util.Set;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;

/**
 * Servlet implementation class TestServlet
 */
@WebServlet("/TestServlet")
public class TestServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public TestServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		System.out.print("yo");
		//G g = new G();
	///	g.getS();
		response.getWriter().println("hello from post sever" + G.message());
		
		IndexG ig = new IndexG();
		String s = request.getParameter("s");
		
		Gtokenize gt = new Gtokenize();
		Set set = gt.getWordPairs(s);
		System.out.println(set.toString());
	
		
		
		//	String s = "om tat sat";
	//	AtomicReader ar =ig.addStringToIndex(s);
		//response.getWriter().println("numb docs" + ir.numDocs() + " string is " + s);
	//HighFreqTerms hft = new HighFreqTerms(ar,5);
		//List top = hft.getHighFrqTerms(11);
		
	}

}
